<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

$log = [
    'default' => [
        'handlers' => [
            [
                'class' => teamones\TeamonesHandler::class,
                'constructor' => [
                    get_formatted_env("log_server_url", ""),
                    Monolog\Logger::DEBUG,
                    true,
                    get_formatted_env("belong_system", '')
                ]
            ],
        ],
    ],
];

if (get_formatted_env('DEBUG_LOG_DRIVE', 'db') === 'file') {
    $log['default']['handlers'][] = [
        'class' => \Monolog\Handler\RotatingFileHandler::class,
        'constructor' => [
            get_formatted_env("LOG_FILE_NAME", runtime_path() . "/logs/log.log"),
            get_formatted_env("LOG_MAX_FILES", 10),
            get_formatted_env("LOG_LEVEL", 'ERROR'),
        ],
    ];
}

return $log;